//
//  MainNavigatorMap.swift
//  Eddard
//
//  Created by eme on 2017/3/21.
//  Copyright © 2017年 seongbrave. All rights reserved.
//

import UIKit
import UtilCore
import URLNavigator
///登陆注册模块的路由
struct MainNavigatorMap {
    
    static func initialize() {
        UtilCoreNavigatorMap.initialize()
        /// 引导界面结束后跳转到登陆界面
        Navigator.map("/tologin"){url, values in
            let appdelegate = UIApplication.shared.delegate as! AppDelegate
            appdelegate.toLoginVc()
            
            return false
        }
        /// 登陆成功跳转到 首页
        Navigator.map("/loginsuccess"){url, values in
            let appdelegate = UIApplication.shared.delegate as! AppDelegate
            appdelegate.setTabBarVc()
            return false
        }
        /// 弹出错误提示信息
        Navigator.map("/showloading"){ url, values in
            guard let fromVc = UIViewController.topMost else {
                return false
            }
            fromVc.view.showLoading()
            return true
        }
        /// 跳转到web 界面
        Navigator.map("/weexvc") { url, values in
            let storyboard = UIStoryboard.init(name: "Main", bundle: nil)
            let mainVc = storyboard.instantiateViewController(withIdentifier: "WeeX_Vc") as! WeeX_Vc
            mainVc.url = url.queryParameters["url"]
            Navigator.push(mainVc)
            return true
        }
        
        
        
    }
}
